﻿using _0016.Gonggong.Models;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _0016.ViewModels
{
    public class ToDoViewModel:BindableBase
    {
        public ToDoViewModel()
        {
            DaiTodos=new ObservableCollection<DaiTODo>();
            CreateToDos();
            AddCommand = new DelegateCommand(Add);
        }

        /// <summary>
        /// 右侧编辑窗口是否展开
        /// </summary>
        private bool isRightDrawerOpen;
        public bool IsRightDrawerOpen
        {
            get { return isRightDrawerOpen; }
            set { isRightDrawerOpen = value; RaisePropertyChanged(); }
        }
        /// <summary>
        /// 添加待办
        /// </summary>
        private void Add()
        {
            IsRightDrawerOpen = true;
        }
        public DelegateCommand AddCommand{ get; private set; }

        private ObservableCollection<DaiTODo> daiTodos;
        public ObservableCollection<DaiTODo> DaiTodos
        {
            get { return daiTodos; }
            set { daiTodos = value; RaisePropertyChanged(); }
        }
        void CreateToDos()
        {
            for (int i = 0; i < 20; i++)
            {
                DaiTodos.Add(new DaiTODo{ Title="标题"+(i+1), Neirong="测试数据...."});
            }
            
        }
    }
}
